package cn.wolfcode.Controller;

import cn.wolfcode.domain.City;
import cn.wolfcode.domain.Province;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class ProvinceController {

    //获取所有省份的json数据
    @RequestMapping("/province")
    @ResponseBody
    public List<Province> getProvince(){
        List<Province> allProvince = Province.getAllProvince();
        return allProvince;
    }

    //获取对应省份的所有城市的json数据
    @RequestMapping("/city")
    @ResponseBody
    public List<City> getCity(Long id){
        List<City> cities = City.getCityByProvinceId(id);
        return cities;
    }

}
